package DBPack;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



public class DBConnectionTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String dbtime;
		String dbUrl = "jdbc:mysql://titan.cmpe.boun.edu.tr:3306/database1";
		String dbClass = "com.mysql.jdbc.Driver";
		String query = "Select * FROM routes";
		String username = "project1";
		String password = "ruQsvBbu";

		try {

		Class.forName("com.mysql.jdbc.Driver");
		Connection con = DriverManager.getConnection(dbUrl,username,password);
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);

			while (rs.next()) {
			dbtime = rs.getString(1);
			System.out.println(dbtime);
			} //end while

		con.close();
		} //end try

		catch(ClassNotFoundException e) {
		e.printStackTrace();
		}

		catch(SQLException e) {
		e.printStackTrace();
		}

	}

}
